<template>
    <div class="order-report">
        <div class="report-table-top-title">退款订单</div>
        <div class="report-table-form1">
            <el-form
                ref="form"
                size="small"
                inline
                :model="form"
                label-width="80px"
            >
                <el-form-item label="退款单号:" prop="userName">
                    <el-input
                        type="text"
                        v-model="form.userName"
                        class="item"
                    ></el-input>
                </el-form-item>
                <el-form-item label="时间:" prop="userName">
                    <div class="flex">
                        <el-date-picker
                            v-model="form.timeStart"
                            type="date"
                            style="width: 140px"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期"
                        ></el-date-picker>
                        <span>-</span>
                        <el-date-picker
                            v-model="form.timeEnd"
                            type="date"
                            style="width: 140px"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期"
                        ></el-date-picker>
                    </div>
                </el-form-item>
                <el-button type="primary" size="small" @click="getList"
                    >查询</el-button
                >
                <el-button type="primary" size="small" @click="resetFields"
                    >重置</el-button
                >
            </el-form>
        </div>
        <div class="page-padding-gray-small"></div>
        <div class="report-table-wrapper">
            <el-table
                :header-cell-style="headerCellStyle"
                size="small"
                :cell-style="cellStyle"
                :data="showList"
                border
                style="width: 100%"
            >
                <el-table-column
                    prop="agentName"
                    label="退款金额"
                ></el-table-column>
                <el-table-column
                    prop="ysSoftwareInventory"
                    label="退款单号"
                ></el-table-column>
                <el-table-column
                    prop="ysUnUseSoftwareInventory"
                    label="收款人"
                ></el-table-column>
                <el-table-column
                    prop="ysUnUseSoftwareInventory"
                    label="退款时间"
                ></el-table-column>
                <el-table-column
                    prop="yjSoftwarePackage"
                    label="备注"
                ></el-table-column>
            </el-table>
        </div>

        <div class="report-table-block">
            <div class="report-table-block-in">
                <el-pagination
                    background
                    :current-page.sync="position"
                    @current-change="handleCurrentChange"
                    :page-size="10"
                    layout="prev, pager, next, total"
                    :total="totalNum"
                ></el-pagination>
            </div>
        </div>
        <div class="page-padding"></div>
    </div>
</template>

<script type="text/ecmascript-6">
export default {
    data: function () {
        return {
            totalNum: 0,
            position: 1,
            form: {},
            options1: [],
            showList: []
        }
    },
    mounted () {
    },
    created () {
        this.getAllAgent()
        this.getPage()
    },
    watch: {
        position () {
            this.getPage()
        }
    },
    components: {
    },
    props: {
        underLine: null
    },
    computed: {
        manageArr () {
            console.log(this.$store.state.manageArr)
            return this.$store.state.manageArr
        },
        roleId () {
            return this.$store.state.roleId
        },
        manageRoleType () {
            return this.$store.state.manageRoleType
        }
    },
    methods: {
        resetFields () {
            this.$refs['form'].resetFields()
            this.position = 1
            this.getList()
        },
        getAllAgent () {
            this.$http.get(this.$store.state.IP + '/systemUserManage/getAgents', {
                data: {
                }
            },
                {
                    'emulateJSON': false
                }
            ).then(response => {
                console.log('-------------------------------------------')
                response = response.body
                console.log(response)
                if (response.ret === '0') {
                    console.log('调用获取所有代理商成功')
                    this.options1 = response.res
                }
                if (response.ret !== '0') {
                    console.log('调用获取所有代理商失败')
                }
                console.log('******************************************')
            }, response => {
                console.log('通讯失败')
            })
        },
        // 换页方法
        handleCurrentChange (val) {
            this.position = val
        },
        getPage () {
            this.$http.post(this.$store.state.IP + '/system/stock/getStockStatistics', {
                data: {
                    ...this.form,
                    page: this.position - 1, // 页数
                    limit: 10 // 一页显示数量
                }
            },
                {
                    'emulateJSON': false
                }
            ).then(response => {
                console.log('-------------------------------------------')
                response = response.body
                console.log(response)
                if (response.ret === '0') {
                    console.log('调用库存列表成功')
                    console.log(response.data)
                    this.showList = response.data.list
                    this.totalNum = response.data.total
                }
                if (response.ret !== '0') {
                    console.log('调用库存列表失败')
                }
                console.log('******************************************')
            }, response => {
                console.log('通讯失败')
            })
        }
    }
}
</script>

<style lang="stylus" rel="stylesheet/stylus" scoped>
.item
    width: 200px

.order-report
    width: 100%
    background: #fff
    min-height: calc(100vh - 65px)

    .report-table-top-title
        width: 100%
        height: 64px
        line-height: 64px
        color: #000
        font-size: 18px
        background: #f1f0f5

    .report-table-form1
        width: 100%
        min-height: 40px
        padding-top: 15px
        box-sizing: border-box
        background: #fff
        overflow: hidden

        .report-table-form1-line
            min-height: 32px
            margin-bottom: 16px

            .report-table-form1-item
                display: inline-block
                vertical-align: top
                height: 32px
                margin-right: 15px
                line-height: 32px

                &.word
                    margin-right: 0

                &.samll
                    font-size: 15px
                    text-align: left

                &.big
                    margin-right: 100px

    .report-table-block
        width: 100%
        padding-top: 22px
        height: 50px
        background: #fff
        box-sizing: border-box

        .report-table-block-in
            float: right
            padding-right: 17px

    .page-padding-gray-small
        width: 100%
        height: 22px
        background: #f1f0f5

    .page-padding
        width: 100%
        height: 20px
        background: #fff

    .report-table-total
        width: 100%
        font-size: 16px
        color: #409EFF
        padding: 22px
        margin-top: 22px
        box-sizing: border-box
        background: #fff
</style>
